<template>
  <div class="sperm-container">
    <!-- 主体表格 -->
    <div class="body">
      <el-table
        ref="multipleTableRef"
        v-loading="loading"
        :data="userList"
        row-key="id"
        style="width: 100%"
        show-overflow-tooltip
      >
        <!-- 基础信息列 -->
        <el-table-column prop="basicInfo.basicId" label="ID" width="60" />
        <el-table-column prop="sysUser.userName" label="用户名" width="150" />
        <el-table-column label="状态" width="100">
          <template #default="{ row }">
            <el-tag v-if="row.sysUser.shzt == 1" type="success">已通过</el-tag>
            <el-tag v-if="row.sysUser.shzt == 0">待审核</el-tag>
            <el-tag v-if="row.sysUser.shzt == 2" type="warning">未通过</el-tag>
          </template>
        </el-table-column>
        <el-table-column
          prop="basicInfo.spermFrozenPrice"
          label="冷冻精子价格"
          width="120"
        />
        <el-table-column
          prop="basicInfo.spermFreshPrice"
          label="新鲜精子价格"
          width="120"
        />
        <el-table-column label="图片数量" width="100">
          <template #default="{ row }">{{ row.photoList.length }}</template>
        </el-table-column>
        <el-table-column label="视频数量" width="100">
          <template #default="{ row }">
            {{
              row.basicInfo.videoUrl
                ? row.basicInfo.videoUrl.split(",").length
                : 0
            }}
          </template>
        </el-table-column>

        <el-table-column prop="basicInfo.fullName" label="姓名" width="100" />
        <el-table-column
          prop="basicInfo.dateOfBirth"
          label="出生年月"
          width="100"
        />
        <el-table-column prop="basicInfo.bloodType" label="血型" width="80" />
        <el-table-column
          prop="basicInfo.height"
          label="身高（米）"
          width="100"
        />
        <el-table-column
          prop="basicInfo.weight"
          label="体重（千克）"
          width="100"
        />
        <el-table-column
          prop="basicInfo.eyeColor"
          label="眼睛颜色"
          width="100"
        />
        <el-table-column prop="basicInfo.hairColor" label="发色" width="100" />
        <el-table-column prop="basicInfo.race" label="种族" width="100" />
        <el-table-column prop="basicInfo.education" label="学历" width="120" />
        <el-table-column
          prop="basicInfo.schoolNameMajor"
          label="学校名称及专业"
          width="180"
        />
        <el-table-column prop="basicInfo.gpa" label="平均绩点" width="100" />
        <el-table-column
          prop="basicInfo.otherExpertise"
          label="其他特长"
          width="180"
        />
        <el-table-column
          prop="basicInfo.maritalStatus"
          label="婚姻状况"
          width="100"
        />
        <el-table-column
          prop="basicInfo.exerciseHabit"
          label="运动习惯"
          width="180"
        />
        <el-table-column
          prop="basicInfo.personality"
          label="性格特点"
          width="180"
        />
        <el-table-column
          prop="basicInfo.hadPlasticSurgery"
          label="是否整形"
          width="80"
        />
        <el-table-column
          prop="basicInfo.spermDonorExperience"
          label="捐精经验"
          width="80"
        />
        <el-table-column prop="basicInfo.pageViews" label="浏览量" width="80" />
        <el-table-column prop="basicInfo.favorites" label="收藏量" width="80" />
        <el-table-column
          prop="basicInfo.donationVolume"
          label="捐赠量"
          width="80"
        />
        <el-table-column
          prop="basicInfo.selfIntroduction"
          label="自我介绍"
          width="200"
        />
        <el-table-column
          prop="basicInfo.rozenDonationDscript"
          label="冷冻捐赠描述"
          width="200"
        />
        <el-table-column
          prop="basicInfo.rozenDonation"
          label="冷冻捐赠"
          width="100"
        />
        <el-table-column
          prop="basicInfo.freshDonation"
          label="新鲜捐赠"
          width="100"
        />
        <el-table-column
          prop="basicInfo.donationType"
          label="捐赠类型"
          width="120"
        />
        <el-table-column prop="basicInfo.firstName" label="名字" width="100" />
        <el-table-column prop="basicInfo.lastName" label="姓" width="100" />
        <el-table-column
          prop="basicInfo.country"
          label="国家代码"
          width="100"
        />
        <el-table-column
          prop="basicInfo.postalCode"
          label="邮政编码"
          width="100"
        />
        <el-table-column prop="basicInfo.region" label="所在地区" width="120" />
        <el-table-column prop="basicInfo.formSource" label="来源" width="120" />
        <el-table-column prop="basicInfo.occupation" label="职业" width="120" />
        <el-table-column
          prop="basicInfo.healthStatus"
          label="健康状况"
          width="120"
        />

        <el-table-column
          label="是否有重大疾病"
          prop="medicalInfo.majorIllness"
        />
        <el-table-column
          label="住院/手术描述"
          prop="medicalInfo.hospitalizationSurgeries"
        />
        <el-table-column
          label="是否有慢性病"
          prop="medicalInfo.chronicConditions"
        />
        <el-table-column
          label="是否有性病"
          prop="medicalInfo.sexuallyTransmittedDiseases"
        />
        <el-table-column
          label="是否有精神问题"
          prop="medicalInfo.psychiatricCare"
        />
        <el-table-column label="是否近视" prop="medicalInfo.nearsightedness" />
        <el-table-column
          label="是否做过近视矫正手术"
          prop="medicalInfo.laserSurgery"
        />
        <el-table-column
          label="牙齿问题描述"
          prop="medicalInfo.dentalProblems"
        />
        <el-table-column
          label="是否有听力问题"
          prop="medicalInfo.hearingProblems"
        />
        <el-table-column label="是否吸烟" prop="medicalInfo.smoking" />
        <el-table-column label="是否喝酒" prop="medicalInfo.drinking" />
        <el-table-column label="是否吸毒" prop="medicalInfo.drugUse" />
        <el-table-column label="过敏史描述" prop="medicalInfo.allergies" />
        <el-table-column
          label="是否有纹身或穿孔"
          prop="medicalInfo.tattoosPiercings"
        />
        <el-table-column
          label="是否有家族遗传病"
          prop="medicalInfo.familyHereditaryDiseases"
        />
        <el-table-column
          label="想当捐精者的原因"
          prop="medicalInfo.reasonToBeSpermDonor"
        />
        <el-table-column label="最喜欢的食物" prop="medicalInfo.favoriteFood" />
        <el-table-column
          label="家庭成长感受"
          prop="medicalInfo.familyGrowthFeeling"
        />
        <el-table-column
          label="最喜欢的运动"
          prop="medicalInfo.favoriteSport"
        />
        <el-table-column
          label="特殊才能与技能"
          prop="medicalInfo.specialTalentsSkills"
        />
        <el-table-column
          label="最喜欢的书及原因"
          prop="medicalInfo.favoriteBookReason"
        />
        <el-table-column label="最不喜欢的事" prop="medicalInfo.dislikes" />
        <el-table-column
          label="人生目标与抱负"
          prop="medicalInfo.lifeGoalAmbition"
        />
        <el-table-column label="是否收养子女" prop="medicalInfo.isAdopted" />
        <el-table-column label="与捐卵者的关系" prop="medicalInfo.relative" />

        <!-- 操作列 -->
        <el-table-column fixed="right" label="操作" min-width="880">
          <template #default="{ row }">
            <el-button link type="primary" @click="reviewDonor(row)"
              >审核</el-button
            >
            <el-button link type="primary" @click="addSetState(row)"
              >捐赠状态</el-button
            >
            <el-button
              link
              type="primary"
              @click="addSetPrice(row.basicInfo.basicId)"
              >定价</el-button
            >
            <el-button link type="primary" @click="setNumber(row)"
              >冷冻卵子数量</el-button
            >
            <el-button link type="primary" @click="setProfile(row)"
              >个人简介</el-button
            >
            <el-button link type="primary" @click="addSetImg(row)"
              >图片</el-button
            >
            <el-button
              link
              type="primary"
              size="small"
              plain
              @click="uploadXVisiable(row)"
            >
              形象图片 <span v-if="havePhoto(row, '个人形象照')">(OK)</span>
            </el-button>
            <el-button
              link
              type="primary"
              size="small"
              plain
              @click="uploadSVisiable(row)"
            >
              缩略图 <span v-if="havePhoto(row, '缩略图')">(OK)</span>
            </el-button>
            <el-button link type="primary" @click="addSetVideo(row)"
              >视频</el-button
            >
            <el-button link type="primary" @click="addSetGene(row)"
              >基因报告</el-button
            >
            <el-button link type="primary" @click="addSetImgEdit(row)"
              >附件管理</el-button
            >
            <el-button link type="primary" @click="edit(row)">编辑</el-button>
            <el-button link type="primary" @click="todelete(row)"
              >删除</el-button
            >
          </template>
        </el-table-column>
      </el-table>

      <!-- 审核 -->
      <reviewSpermDonors
        v-if="shVisiable"
        :donor-id="formState.basicInfo.basicId"
        :visiable="shVisiable"
        @close-dialog="closeShDialog"
      />

      <!-- 捐赠状态 -->
      <el-dialog
        v-model="stateCenterDialogVisible"
        title="设置捐赠状态"
        width="500"
        center
      >
        <el-radio-group v-model="radio">
          <el-radio :value="0">捐赠就绪</el-radio>
          <el-radio :value="1">停止捐赠</el-radio>
          <el-radio :value="2">捐赠中</el-radio>
        </el-radio-group>
        <template #footer>
          <el-button @click="stateCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitSetState">确定</el-button>
        </template>
      </el-dialog>

      <!-- 定价 -->
      <el-dialog v-model="centerDialogVisible" title="定价" width="600">
        <el-form label-width="auto">
          <el-form-item label="冷冻精子价格">
            <el-input v-model="centerDialog.spermFrozenPrice" clearable />
          </el-form-item>
          <el-form-item label="新鲜精子价格">
            <el-input v-model="centerDialog.spermFreshPrice" clearable />
          </el-form-item>
        </el-form>
        <template #footer>
          <el-button @click="centerDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitSetPrice">确定</el-button>
        </template>
      </el-dialog>

      <!-- 冷冻卵子数量 -->
      <el-dialog
        v-model="numberCenterDialogVisible"
        title="冷冻卵子数量"
        width="500"
        center
      >
        <el-input-number v-model="num" :min="1" :max="10" />
        <template #footer>
          <el-button @click="numberCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitSetNumber">确定</el-button>
        </template>
      </el-dialog>

      <!-- 个人简介 -->
      <el-dialog
        v-model="profileCenterDialogVisible"
        title="设置个人简介"
        width="500"
        center
      >
        <el-input v-model="textarea" type="textarea" :rows="8" />
        <template #footer>
          <el-button @click="profileCenterDialogVisible = false"
            >取消</el-button
          >
          <el-button type="primary" @click="submitSetProfile">确定</el-button>
        </template>
      </el-dialog>

      <!-- 上传图片 -->
      <el-dialog v-model="imgCenterDialogVisible" title="上传图片" width="820">
        <el-upload
          v-model:file-list="pfileList"
          :action="uploadUrl"
          :headers="headers"
          list-type="picture-card"
          multiple
          :auto-upload="false"
          accept="image/*"
        >
          <el-icon><Plus /></el-icon>
          <template #tip>
            <div class="el-upload__tip">
              仅支持 jpeg,jpg,png,gif 且不超过 10MB（1：儿时照 2：艺术照
              3：生活照）
            </div>
          </template>
        </el-upload>
        <template #footer>
          <el-button @click="imgCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitUpload">确定</el-button>
        </template>
      </el-dialog>

      <!-- 图片修改 -->
      <el-dialog
        v-model="imgCenterDialogVisibleEdit"
        title="图片修改"
        width="820"
        center
      >
        <el-upload
          v-model:file-list="pfileListEdit"
          :action="uploadUrl"
          :headers="headers"
          list-type="picture-card"
          :auto-upload="false"
          accept="image/*"
        >
          <template #tip>
            <div class="el-upload__tip">
              仅支持 jpeg,jpg,png,gif 且不超过 10MB
            </div>
          </template>
        </el-upload>
        <template #footer>
          <el-button @click="imgCenterDialogVisibleEdit = false"
            >取消</el-button
          >
          <el-button type="primary" @click="submitUploadEdit">确定</el-button>
        </template>
      </el-dialog>

      <!-- 形象图片 -->
      <rightPhoto
        v-if="xVisiable"
        :donor-id="formState.basicInfo.basicId"
        :visiable="xVisiable"
        @close-dialog="closeDialog"
      />

      <!-- 缩略图 -->
      <rightPhotos
        v-if="sVisiable"
        :user-name="formState.sysUser.userName"
        :donor-id="formState.basicInfo.basicId"
        :visiable="sVisiable"
        @close-dialog="closeDialogs"
      />

      <!-- 上传视频 -->
      <el-dialog
        v-model="videoCenterDialogVisible"
        title="上传视频"
        width="600"
      >
        <el-upload
          ref="videoUploadRef"
          v-model:file-list="videoList"
          :action="uploadUrlVideo"
          :headers="headers"
          multiple
          :limit="5"
          accept="video/mp4"
          :auto-upload="false"
          :before-upload="beforeUploadVideo"
          :on-remove="handleRemoveVideo"
        >
          <el-icon><Plus /></el-icon>
          <template #tip>
            <div class="el-upload__tip">最多上传 5 个视频，单个不超过 50MB</div>
          </template>
        </el-upload>
        <template #footer>
          <el-button @click="videoCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitUploadVideo">确定</el-button>
        </template>
      </el-dialog>

      <!-- 上传基因报告 -->
      <el-dialog
        v-model="geneCenterDialogVisible"
        title="上传基因报告"
        width="600"
      >
        <el-upload
          ref="uploadPdfRef"
          v-model:file-list="fileList"
          :action="uploadPdfImgUrl"
          :headers="headers"
          drag
          :auto-upload="false"
          accept=".jpg,.jpeg,.png,.gif,.pdf"
        >
          <el-icon><UploadFilled /></el-icon>
          <div>将文件拖到此处，或<em>点击上传</em></div>
          <template #tip>
            <div class="el-upload__tip">
              仅支持 jpg/png/gif/pdf，且不超过 10MB
            </div>
          </template>
        </el-upload>
        <template #footer>
          <el-button @click="geneCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="submitPdf">确定</el-button>
        </template>
      </el-dialog>

      <!-- 删除确认 -->
      <el-dialog
        v-model="delCenterDialogVisible"
        title="删除捐精者信息"
        width="500"
        center
      >
        <strong>您确定要删除捐精者信息吗？</strong>
        <template #footer>
          <el-button @click="delCenterDialogVisible = false">取消</el-button>
          <el-button type="primary" @click="deleteRows">确定</el-button>
        </template>
      </el-dialog>
    </div>

    <!-- 分页 -->
    <div class="navigation">
      <el-pagination
        v-model:current-page="queryParams.pageNum"
        v-model:page-size="queryParams.pageSize"
        :total="total"
        :page-sizes="[10, 20, 50, 100]"
        layout="total, sizes, prev, pager, next, jumper"
        @size-change="handleSizeChange"
        @current-change="handleCurrentChange"
      />
    </div>
  </div>
</template>

<script lang="ts" setup>
/* -------------------- 依赖 -------------------- */
import { ref, reactive, onMounted, toRaw, watch } from "vue";
import { ElMessage as message } from "element-plus";
import { useRouter } from "vue-router";
import { getToken } from "@/utils/auth";
import {
  listSperm,
  setPrice,
  updateFileInfo,
  deleteInfo,
  updatePhoto,
} from "@/api/business/sperm";
import { uploadFiles } from "@/api/business/upload";

/* -------------------- 子组件 -------------------- */
import rightPhoto from "./components/rightPhoto.vue";
import rightPhotos from "./components/rightPhotos.vue";
import reviewSpermDonors from "./components/reviewSpermDonors.vue";

/* -------------------- 常量/变量 -------------------- */
const router = useRouter();

const headers = { Authorization: "Bearer " + getToken() };

const loading = ref(true);
const userList = ref<any[]>([]);
const total = ref(0);

const queryParams = reactive({
  pageNum: 1,
  pageSize: 10,
  userName: undefined,
  phonenumber: undefined,
  status: undefined,
  deptId: undefined,
  basicIds: [] as number[],
  descValue: "desc",
});

/* 表单状态 */
const formState = reactive<any>({
  sysUser: { userName: "" },
  basicInfo: { basicId: "", videoUrl: "", geneReport: "" },
  photoList: [],
});

/* 弹窗控制 */
const centerDialogVisible = ref(false);
const stateCenterDialogVisible = ref(false);
const profileCenterDialogVisible = ref(false);
const numberCenterDialogVisible = ref(false);
const imgCenterDialogVisible = ref(false);
const imgCenterDialogVisibleEdit = ref(false);
const videoCenterDialogVisible = ref(false);
const geneCenterDialogVisible = ref(false);
const delCenterDialogVisible = ref(false);

const shVisiable = ref(false);
const xVisiable = ref(false);
const sVisiable = ref(false);

/* 上传相关 */
const uploadUrl = ref("");
const uploadUrlVideo = ref("");
const uploadPdfImgUrl = ref("");
const fileList = ref<any[]>([]);
const pfileList = ref<any[]>([]);
const pfileListEdit = ref<any[]>([]);
const videoList = ref<any[]>([]);
const photoList = ref<any[]>([]);

/* 临时变量 */
const centerDialog = ref({ spermFrozenPrice: "", spermFreshPrice: "" });
const radio = ref(0);
const num = ref(1);
const textarea = ref("");
const rowId = ref<number | string>("");

/* -------------------- 方法 -------------------- */
const getList = () => {
  loading.value = true;
  listSperm(queryParams).then((res) => {
    loading.value = false;
    userList.value = res.rows;
    total.value = res.total;
  });
};

const search = (listQuery?: any) => {
  const q = listQuery || queryParams;
  loading.value = true;
  listSperm(q).then((res) => {
    loading.value = false;
    userList.value = res.rows;
    total.value = res.total;
  });
};
function havePhoto(row, type) {
  return row.photoList.some((data) => data.photoType === type);
}
const handleSizeChange = (val: number) => {
  queryParams.pageSize = val;
  getList();
};

const handleCurrentChange = (val: number) => {
  queryParams.pageNum = val;
  getList();
};

/* 审核 */
const reviewDonor = (row: any) => {
  Object.assign(formState, toRaw(row));
  shVisiable.value = true;
};
const closeShDialog = () => {
  shVisiable.value = false;
  getList();
};

/* 编辑 */
const edit = (row: any) => {
  router.push({
    path: "/businessSperm/addSpermDonors",
    query: { basicId: row.basicInfo.basicId },
  });
};

/* 删除 */
const todelete = (row: any) => {
  delCenterDialogVisible.value = true;
  rowId.value = row.basicInfo.basicId;
};
const deleteRows = () => {
  deleteInfo(rowId.value).then((res) => {
    if (res.code === 200) {
      message.success("删除成功");
      delCenterDialogVisible.value = false;
      getList();
    } else {
      message.error("删除失败");
    }
  });
};

/* 捐赠状态 */
const addSetState = (row: any) => {
  rowId.value = row.basicInfo.basicId;
  radio.value = 0;
  stateCenterDialogVisible.value = true;
};
const submitSetState = () => {
  // 接口根据实际业务自行调整
  setPrice({ donorId: rowId.value, state: radio.value }).then(() => {
    stateCenterDialogVisible.value = false;
    getList();
  });
};

/* 定价 */
const addSetPrice = (id: string | number) => {
  rowId.value = id;
  centerDialog.value = { spermFrozenPrice: "", spermFreshPrice: "" };
  centerDialogVisible.value = true;
};
const submitSetPrice = () => {
  setPrice({ basicId: rowId.value, ...centerDialog.value }).then(() => {
    centerDialogVisible.value = false;
    getList();
  });
};

/* 冷冻卵子数量 */
const setNumber = (row: any) => {
  rowId.value = row.basicInfo.basicId;
  num.value = 1;
  numberCenterDialogVisible.value = true;
};
const submitSetNumber = () => {
  setPrice({ basicId: rowId.value, donationVolume: num.value }).then(() => {
    numberCenterDialogVisible.value = false;
    getList();
  });
};

/* 个人简介 */
const setProfile = (row: any) => {
  rowId.value = row.basicInfo.basicId;
  textarea.value = "";
  profileCenterDialogVisible.value = true;
};
const submitSetProfile = () => {
  setPrice({ basicId: rowId.value, selfIntroduction: textarea.value }).then(
    () => {
      profileCenterDialogVisible.value = false;
      getList();
    }
  );
};

/* 图片 / 视频 / 基因报告 */
const addSetImg = (row: any) => {
  Object.assign(formState, toRaw(row));
  pfileList.value = [];
  imgCenterDialogVisible.value = true;
};

const uploadXVisiable = (row: any) => {
  Object.assign(formState, toRaw(row));
  xVisiable.value = true;
};
const closeDialog = () => (xVisiable.value = false);

const uploadSVisiable = (row: any) => {
  Object.assign(formState, toRaw(row));
  sVisiable.value = true;
};
const closeDialogs = () => (sVisiable.value = false);

const addSetImgEdit = (row: any) => {
  Object.assign(formState, toRaw(row));
  pfileListEdit.value = row.photoList.map((item: any) => ({
    ...item,
    url: item.photoUrl,
  }));
  imgCenterDialogVisibleEdit.value = true;
};

const addSetVideo = (row: any) => {
  Object.assign(formState, toRaw(row));
  videoList.value = [];
  videoCenterDialogVisible.value = true;
};

const addSetGene = (row: any) => {
  Object.assign(formState, toRaw(row));
  fileList.value = [];
  geneCenterDialogVisible.value = true;
};

/* 上传钩子 */
const beforeUploadVideo = (file: File) => {
  const isVideo = file.type.startsWith("video/");
  const isLt50M = file.size / 1024 / 1024 < 50;
  if (!isVideo) {
    message.error("只能上传视频文件");
    return false;
  }
  if (!isLt50M) {
    message.error("视频大小不能超过 50MB");
    return false;
  }
  return true;
};

const handleRemoveVideo = (_: any, fileList_: any[]) => {
  videoList.value = fileList_;
};

const handleExceed = () => message.warning("最多上传 3 张图片");
const handleExceedVideo = () => message.warning("最多上传 5 个视频");

/* 上传图片 */
const submitUpload = async () => {
  if (!pfileList.value.length) return message.warning("请先选择图片");
  uploadUrl.value =
    "/business/photo/uploads?username=" + formState.sysUser.userName;
  const formData = new FormData();
  pfileList.value.forEach((file) => formData.append("files", file.raw!));
  const res = await uploadFiles(formData, uploadUrl.value);
  formState.photoUrls = res.urls;
  formState.basicInfo.videoUrl = null;
  formState.basicInfo.geneReport = null;
  updateForm(formState);
  imgCenterDialogVisible.value = false;
};

/* 上传视频 */
const submitUploadVideo = async () => {
  if (!videoList.value.length) return message.warning("请先选择视频");
  uploadUrlVideo.value =
    "/business/photo/uploadVideo?username=" + formState.sysUser.userName;
  const formData = new FormData();
  videoList.value.forEach((file) => formData.append("files", file.raw!));
  const res = await uploadFiles(formData, uploadUrlVideo.value);
  formState.basicInfo.videoUrl = res.urls;
  formState.photoUrls = null;
  updateForm(formState);
  videoCenterDialogVisible.value = false;
};

/* 上传基因报告 */
const submitPdf = async () => {
  if (!fileList.value.length) return message.warning("请先选择文件");
  uploadPdfImgUrl.value =
    "/business/photo/upload?type=pdfs&username=" + formState.sysUser.userName;
  const formData = new FormData();
  fileList.value.forEach((file) => formData.append("file", file.raw!));
  const res = await uploadFiles(formData, uploadPdfImgUrl.value);
  formState.basicInfo.geneReport = res.url;
  formState.photoUrls = null;
  updateForm(formState);
  geneCenterDialogVisible.value = false;
};

/* 修改图片 */
const submitUploadEdit = async () => {
  const urls = pfileListEdit.value.map((item) => item.url).join(",");
  await updatePhoto({ basicId: formState.basicInfo.basicId, photoUrls: urls });
  message.success("更新成功");
  imgCenterDialogVisibleEdit.value = false;
  getList();
};

/* 更新用户信息 */
const updateForm = (form: any) => {
  updateFileInfo(form).then((resp) => {
    if (resp.code === 200) {
      message.success("上传成功");
      getList();
    } else {
      message.error("上传失败");
    }
    fileList.value = [];
    pfileList.value = [];
    videoList.value = [];
  });
};

/* -------------------- 生命周期 -------------------- */
onMounted(() => {
  getList();
});

/* -------------------- 暴露方法 -------------------- */
defineExpose({ search });
</script>

<style lang="scss" scoped>
.navigation {
  width: 600px;
  margin: 60px auto;
}

.containerEdit :deep(.el-upload--picture-card) {
  display: none !important;
}
</style>
